<%@ page language="java" 
         contentType="text/html; charset=windows-1256"
         pageEncoding="windows-1256"
         import="LoginUtil.*"
         import="java.sql.*"
         import="persistent.*"
         import="com.db4o.ObjectContainer"
         import="com.db4o.ObjectSet"
   %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<% User patient = (User)session.getAttribute("KEY_VIEWING_PATIENT"); 
		//Gets user's treatment records from database
 	   ObjectContainer container = Db4oServletListener.getObjectContainer(this.getServletContext());
 	   TreatmentRecord predicate = new TreatmentRecord(patient);
 	   ObjectSet<TreatmentRecord> recordResultSet = container.queryByExample(predicate);
 	   TreatmentRecord temp;
	%>
         <meta http-equiv="Content-Type" 
            content="text/html; charset=windows-1256">
         <title>   Viewing Treatment Records of <%=patient.getFirstName()%> <%=patient.getLastName()%>   </title>
         <link rel="stylesheet" type="text/css" href="style.css" />
	</head>

<body>

	<center>
		<br><br><br><br>
		<div id="header">To view one of <%=patient.getFirstName()%> <%=patient.getLastName()%>'s treatment records, click a date below.</div>
		<br><br>
			<TABLE cellpadding="5" border="1" style="foreground-color: #000000;">
				<%
					while(recordResultSet.hasNext()){
						temp = recordResultSet.next();
						out.println("<FORM NAME='viewtreatmentrecordform' ACTION='ViewTreatmentRecordServlet' METHOD='GET'>");
						out.println("<input type='hidden' name='treatmentrecordname' value='"+temp.getPatient()+"' />");
						out.println("<input type='hidden' name='treatmentrecorddate' value='"+temp.getDate()+"' />");
						out.println("<tr><th>Date:</th><th><input type='submit' name='viewtreatmentrecordbutton value='"+temp.getDate()+"' /></th></tr>");
						out.println("</FORM>");
					}
				%>
		
			</TABLE>
	</center>

</body>



</html>